/*
 * Created: Author: Aléx Carvalho / Date: Mar 7, 2015
 * 
 * Changed: $Author: ac280593@gmail.com $ / $Date: 2015-06-11 04:28:43 +0000 (Thu, 11 Jun 2015) $
 */
package com.cpm.entities.converters;

import com.cpm.entities.id.IntegerId;
import javax.persistence.AttributeConverter;

public class IntegerIdConverter implements AttributeConverter<IntegerId, Integer> {

    @Override
    public Integer convertToDatabaseColumn(IntegerId attribute) {
        return attribute.getId();
    }

    @Override
    public IntegerId convertToEntityAttribute(Integer dbData) {
        return new IntegerId(dbData);
    }
}
